# -*- coding:utf-8 -*-
# @FileName :game_manager.py
# @Created  :2024/9/29
# @Author   :天空之城
from game.TexasHoldem.game_base import BaseGame


class GameManager(BaseGame):
    def __init__(self, players):
        BaseGame.__init__(self, players)

    def start_game(self):
        # 摊牌
        self.deck.shuffle()
        # 公共牌翻牌圈
        self.play_flop()
        self.betting.place_bet()
        # 公共牌转牌圈
        self.play_turn()
        # 公共牌河牌圈
        self.play_river()
        # 摊牌
        winner = self.showdown()
        self.betting.resolve_bets(winner)

        print(f"赢家是玩家 {winner.name}，他现在有 {winner.chips} 筹码。")
        # 重置游戏状态，准备下一局
        self.reset_game()

        return winner
